package com.gitee.cheungming.search.controller;

import com.gitee.cheungming.common.Result;
import com.gitee.cheungming.search.doc.GoodsDocument;
import com.gitee.cheungming.search.service.GoodsDocumentService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/goods")
public class GoodsDocumentController {

    @Resource
    GoodsDocumentService goodsDocumentService;

    @RequestMapping("/test")
    public String test() {
        return "测试商品";
    }

    @RequestMapping("/list")
    public Result<List<GoodsDocument>> list(@RequestParam String keyword) {
        List<GoodsDocument> list = goodsDocumentService.list(keyword);
        return Result.success(list);
    }
}
